-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(tree-explorer): add buttons to ask Copilot and create playgrounds from tree view VSCODE-651 #890
Conversation
Co-authored-by: Alena Khineika <[email protected]>
…nto gagik/add-playground-buttons
…nto gagik/add-icons
…agik/add-playground-buttons
b32976e
to
82cff2a
Compare
82cff2a
to
aeee828
Compare
@@ -0,0 +1,10 @@ | |||
/** Wraps a template function and escapes given string arguments. */ | |||
export function createTemplate<T extends (...args: string[]) => string>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we're going for string escaping, I thought it might be nice to switch to something more type-safe and use functions + string templates, would help keep track of variables used better.
I could convert other templates at a later time also, but this could be a nice starting point, unless there's benefits to replacing that I might be overseeing.
In case we end up with content that needs to not be escaped somehow, we could expand this function to support more complex cases but for now I just wanted to create a wrapper.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to use handlebars or a similar templating engine rather than roll something ourselves?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that might be nice though not sure how complex our templates can get; in any case I'd maybe personally prefer an engine written with TypeScript in mind like eta
With stuff like replacing characters we'd probably end up handling it ourselves or use a plugin with these template engines. Honestly to me having a function build a string seems like a nicer experience mainly because of arguments being exposed in the IDE though perhaps a template engine would be more scalable for the future.
cc: @alenakhineika
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With Gaurab we have discussed a revamp of how we do templates with things like adding shortcut information to them, it might be a better moment to discuss introducing i.e. a templating engine, I created VSCODE-661 to keep track of that.
I could go ahead with this setup for now just to have it in for release and we can change it to whatever we decide more globally later.
Includes everything in VSCODE-651 other than telemetry as I ended up doing some minor refactoring in it for in #891